<?php

namespace App\Console\Commands;

use App\Jobs\test\TestJob;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Log;

class TestRedisList extends Command
{
    /**
     * The name and signature of the console command.
     * php artisan command:testredislist
     * 添加redis队列
     * @var string
     */
    protected $signature = 'command:testredislist';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '测试调度任务';

    /**
     * Execute the console command.
     *
     * @return int
     */
    public function handle()
    {
//        $int = 1;
//        while(1){
//            $this->info('测试任务：redis队列');
//            $this->info('data='.$int);
//            TestJob::dispatch($int)->onQueue('testredislist');
//            sleep(10);
//            $this->info('睡眠10秒执行下一个任务');
//            $int++;
//        }
        Log::channel('redislist')->info('测试调度任务');



        return Command::SUCCESS;
    }
}
